package org.hxc.utils;

import cn.hutool.jwt.JWT;
import cn.hutool.jwt.JWTUtil;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Map;


public class ShiroJwtUtil {

    private static final byte[] key = "换成你的密匙".getBytes();

    /*
     * 创建
     */
    public static String createToken(Map<String, Object> payload){
        return JWTUtil.createToken(payload, ShiroJwtUtil.key);
    }


    /*
     * 解析
     */
    public static JWT parseToken(String token){
        JWT jwt = JWTUtil.parseToken(token);
        return jwt;
    }


    /*
     * 验证
     */
    public static Boolean verify(String token){
        return JWTUtil.verify(token, ShiroJwtUtil.key);
    }
}